<template>
  <div>
    <a-input-search
      v-model="value"
      placeholder="请先选择物料种类"
      readOnly
      unselectable="on"
      @search="onSearchGoodsCategory">
      <a-button slot="enterButton" v-show="showButton">选择物料种类</a-button>
    </a-input-search>

    <j-select-goods-category-list-modal
      ref="selectGoodsCategoryList"
      :modal-width="modalWidth"
      @categoryOk="selectOK"/>
  </div>
</template>
<script>
import JSelectGoodsCategoryListModal from "@comp/base/modal/JSelectGoodsCategoryListModal";

export default {
  components: {JSelectGoodsCategoryListModal},
  props: {
    modalWidth: {
      type: Number,
      default: 1250,
      required: false
    },
    value: {
      type: String,
      default: '',
    },
    showButton: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      textVals: ''
    }
  },
  computed:{

  },
  comments: {},
  methods: {
    onSearchGoodsCategory() {
      this.$refs.selectGoodsCategoryList.showModal();
    },
    selectOK(rows) {
      // value
      // this.value = "";
      if (rows) {
        // this.value = rows.name;
        this.$emit("onGoodsCategorySelected", rows);
      }
    }
  }
}
</script>